#include <stdio.h>
int max(int a[], int n) {
  int result = a[0], i;
  for (i = 1; i < n; i++)
    if (result < a[i])
      result = a[i];
  return result;
}

int min(int a[], int n) {
  int result = a[0], i;
  for (i = 1; i < n; i++)
    if (result > a[i])
      result = a[i];
  return result;
}
int sum(int a[], int n) {
  int result = a[0], i;
  for (i = 1; i < n; i++)
    result += a[i];
  return result;
}

int main() {
  int a[100], n, i;
  while (1 == scanf("%d", &n)) {
    for (i = 0; i < n; i++)
      scanf("%d", a + i);
    printf("%.2f\n", 1.0 *(sum(a, n) - max(a, n) - min(a, n)) / (n - 2));
  }
  return 0;
}
